{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nvar FormContext = /*#__PURE__*/React.createContext({\n  triggerFormChange: function triggerFormChange() {},\n  triggerFormFinish: function triggerFormFinish() {},\n  registerForm: function registerForm() {},\n  unregisterForm: function unregisterForm() {}\n});\nvar FormProvider = function FormProvider(_ref) {\n  var validateMessages = _ref.validateMessages,\n    onFormChange = _ref.onFormChange,\n    onFormFinish = _ref.onFormFinish,\n    children = _ref.children;\n  var formContext = React.useContext(FormContext);\n  var formsRef = React.useRef({});\n  return /*#__PURE__*/React.createElement(FormContext.Provider, {\n    value: _objectSpread(_objectSpread({}, formContext), {}, {\n      validateMessages: _objectSpread(_objectSpread({}, formContext.validateMessages), validateMessages),\n      // =========================================================\n      // =                  Global Form Control                  =\n      // =========================================================\n      triggerFormChange: function triggerFormChange(name, changedFields) {\n        if (onFormChange) {\n          onFormChange(name, {\n            changedFields: changedFields,\n            forms: formsRef.current\n          });\n        }\n        formContext.triggerFormChange(name, changedFields);\n      },\n      triggerFormFinish: function triggerFormFinish(name, values) {\n        if (onFormFinish) {\n          onFormFinish(name, {\n            values: values,\n            forms: formsRef.current\n          });\n        }\n        formContext.triggerFormFinish(name, values);\n      },\n      registerForm: function registerForm(name, form) {\n        if (name) {\n          formsRef.current = _objectSpread(_objectSpread({}, formsRef.current), {}, _defineProperty({}, name, form));\n        }\n        formContext.registerForm(name, form);\n      },\n      unregisterForm: function unregisterForm(name) {\n        var newForms = _objectSpread({}, formsRef.current);\n        delete newForms[name];\n        formsRef.current = newForms;\n        formContext.unregisterForm(name);\n      }\n    })\n  }, children);\n};\nexport { FormProvider };\nexport default FormContext;","map":{"version":3,"names":["_defineProperty","_objectSpread","React","FormContext","createContext","triggerFormChange","triggerFormFinish","registerForm","unregisterForm","FormProvider","_ref","validateMessages","onFormChange","onFormFinish","children","formContext","useContext","formsRef","useRef","createElement","Provider","value","name","changedFields","forms","current","values","form","newForms"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/rc-field-form/es/FormContext.js"],"sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nvar FormContext = /*#__PURE__*/React.createContext({\n  triggerFormChange: function triggerFormChange() {},\n  triggerFormFinish: function triggerFormFinish() {},\n  registerForm: function registerForm() {},\n  unregisterForm: function unregisterForm() {}\n});\nvar FormProvider = function FormProvider(_ref) {\n  var validateMessages = _ref.validateMessages,\n    onFormChange = _ref.onFormChange,\n    onFormFinish = _ref.onFormFinish,\n    children = _ref.children;\n  var formContext = React.useContext(FormContext);\n  var formsRef = React.useRef({});\n  return /*#__PURE__*/React.createElement(FormContext.Provider, {\n    value: _objectSpread(_objectSpread({}, formContext), {}, {\n      validateMessages: _objectSpread(_objectSpread({}, formContext.validateMessages), validateMessages),\n      // =========================================================\n      // =                  Global Form Control                  =\n      // =========================================================\n      triggerFormChange: function triggerFormChange(name, changedFields) {\n        if (onFormChange) {\n          onFormChange(name, {\n            changedFields: changedFields,\n            forms: formsRef.current\n          });\n        }\n        formContext.triggerFormChange(name, changedFields);\n      },\n      triggerFormFinish: function triggerFormFinish(name, values) {\n        if (onFormFinish) {\n          onFormFinish(name, {\n            values: values,\n            forms: formsRef.current\n          });\n        }\n        formContext.triggerFormFinish(name, values);\n      },\n      registerForm: function registerForm(name, form) {\n        if (name) {\n          formsRef.current = _objectSpread(_objectSpread({}, formsRef.current), {}, _defineProperty({}, name, form));\n        }\n        formContext.registerForm(name, form);\n      },\n      unregisterForm: function unregisterForm(name) {\n        var newForms = _objectSpread({}, formsRef.current);\n        delete newForms[name];\n        formsRef.current = newForms;\n        formContext.unregisterForm(name);\n      }\n    })\n  }, children);\n};\nexport { FormProvider };\nexport default FormContext;"],"mappings":"AAAA,OAAOA,eAAe,MAAM,2CAA2C;AACvE,OAAOC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